package com.ideabove.radio;

import java.util.Hashtable;

import com.ideabove.radio.R;

import android.net.Uri;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.util.Log;
import android.view.Menu;

public class KakaoIntroActivity extends Activity {

	Uri data;
	
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);   
        setContentView(R.layout.layout_intro);
        
        data = getIntent().getData();
        new WaitThread().start();                
    }
    
    @Override
	protected void onNewIntent(Intent intent) {
    	
    	Intent newIntent = new Intent(KakaoIntroActivity.this, MainActivity.class);
    	
    	
		startActivity(newIntent);
		finish();
		super.onNewIntent(intent);
	}
    
    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.activity_intro, menu);
        return true;
    }
    
   class WaitThread extends Thread{
	   @Override
	   public void run(){
		   try{
			   Thread.sleep(2000);
			   Intent intent = new Intent(KakaoIntroActivity.this, MainActivity.class);
			   intent.putExtra("q", data.getQueryParameter("q"));
			   intent.putExtra("cid", data.getQueryParameter("cid"));
			   intent.putExtra("link", data.getQueryParameter("link"));
			   startActivity(intent);
			   finish();
		   }catch(InterruptedException e){
			   e.printStackTrace();
		   }
	   }
   }
    
}
